# coding=utf-8
a = []
b = []
c = {}
while True:
    try:
        words = input()
        a.append(words.split('\\')[-1])

    except:
        for i in a:
            path = i.split(" ")[0]
            lines = i.split(' ')[1]
            realptath = path[-16:]
            c.setdefault(realptath + lines, 0)
            cache = []
            cache.append(realptath)
            cache.append(lines)
            if not cache in b:
                b.append(cache)
            c[realptath + lines] += 1
        for item in b[-8:]:
            print(item[0], item[1], c[item[0] + item[1]])

        break
